package com.longyi.tenant;

/**
 * @Description 全局租户id持有者类
 * @Date 2020-08-26 5:14 下午
 * @Author wuyanshen
 */
public class TenantHolder {

    private final static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();

    public static Integer getTenantId(){
        return threadLocal.get();
    }

    public static void setTenantId(Integer tenantId){
        threadLocal.set(tenantId);
    }

    public static void clear(){
        threadLocal.remove();
    }
}
